package cn.itcast.up.common.mytest;

/**
 * 演示回调函数
 */
public class TestDemo {


    //接口
    public static void main(String[] args) {

        //先创建一个电脑对象
        Compute compute = new Compute();
        compute.usb(new Mouse());
//        compute.usb(new KeyBord());
        compute.usb(() ->{
            System.out.println("电脑插入一个软宝宝");
        });
    }

}
class Mouse implements USBDevice{

    @Override
    public void click() {
        System.out.println("鼠标被点击了");
    }
}
class KeyBord implements USBDevice{

    @Override
    public void click() {
        System.out.println("键盘被插入电脑了");
    }
}
